package com.test;


import java.io.File;
import java.util.List;

/**
 *
 *
 * @Author liw
 * @Date 2021/5/18 9:01
 * @Version 1.0
 */
public class FileTest {

    public static void main(String[] args) {
        String mypath = System.getProperty("mypath");
        String flag = System.getProperty("flag");
        System.out.println(mypath);
        System.out.println(flag);
        System.out.println();
        change(mypath, flag);
    }

    // https://blog.csdn.net/qq_31914787/article/details/88064557
    // https://blog.csdn.net/quzhongxin/article/details/45336333
    private static void change (String mypath, String flag) {
        List<File> fileList ;
        if ("true".equals(flag)) {
            fileList = DevFileUtil.getFileListAll(mypath);
        } else {
            fileList = DevFileUtil.getFileList(mypath);
        }
        for (File file : fileList) {
            String name = file.getName();
            String newName = name.toUpperCase();
            String newPath = file.getParent() + File.separator + newName;
            DevFileUtil.fixFileName(file.getPath(), newPath);
        }
    }

}
